<!--
 * @Author: zengwj
 * @Date: 2022-06-22 17:18:44
 * @LastEditors: zengwj
 * @LastEditTime: 2022-06-22 17:18:45
 * @Description: 
-->
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    function createAnother(original) {
      var clone = object(original); // 通过调用 object() 函数创建一个新对象
      clone.sayHi = function () {  // 以某种方式来增强对象
        alert("hi");
      };
      return clone; // 返回这个对象
    }
    var person = {
      name: "Nicholas",
      friends: ["Shelby", "Court", "Van"]
    };
    var anotherPerson = createAnother(person);
    anotherPerson.sayHi(); //"hi"

  </script>
</body>

</html>